package com.cocotea.example.myannotation;

import com.cocotea.valid.service.IValidDispatcher;
import com.cocotea.valid.constant.MessageConstant;

import java.lang.reflect.Field;

public class MyValidHandler implements IValidDispatcher {
    @Override
    public String doValid(Field field, Object value, String annotationName) {
        MyValidAnnotation annotation = field.getAnnotation(MyValidAnnotation.class);
        if (value == null && "MyValidAnnotation".equals(annotationName)) {
            return "MyValidAnnotation come in.annotation value="+annotation.value();
        }
        return MessageConstant.SUCCESS;
    }
}
